package com.aaa.cars.controller;

import com.aaa.cars.entity.BrandBigpic;
import com.aaa.cars.service.BrandBigpicService;
import com.aaa.common.constants.ReturnStatus;
import com.aaa.common.util.Result;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * (BrandBigpic)表控制层
 *
 * @author makejava
 * @since 2020-12-12 11:13:15
 */
@RestController
@RequestMapping("brandBigpic")
public class BrandBigpicController {
    /**
     * 服务对象
     */
    @Resource
    private BrandBigpicService brandBigpicService;

    /**
     * 通过主键查询单条数据
     *
     * @param brandid 主键
     * @return 单条数据
     */
    @GetMapping("selectOne")
    @ApiOperation("通过主键查询单条数据")
    public BrandBigpic selectOne(Long brandid) {
        return this.brandBigpicService.queryById(brandid);
    }

    /**
     * 查询所有分页加条件查询
     *
     * @param brandBigpic 实体
     * @return Result
     */
    @PostMapping("queryAll")
    @ApiOperation("查询所有分页加条件查询")
    public Result queryAll(@RequestBody BrandBigpic brandBigpic) {
        return this.brandBigpicService.queryAll(brandBigpic);
    }

    /**
     * 根据ID删除
     *
     * @param brandid
     * @return Result
     */
    @DeleteMapping("deleteById")
    @ApiOperation("根据ID删除")
    public Result deleteById(Integer brandid) {
        return new Result(ReturnStatus.SUCCESS.getReturnCode(),
                ReturnStatus.SUCCESS.getReturnMsg(), this.brandBigpicService.deleteById(brandid));
    }

    /**
     * 更新
     *
     * @param @param brandBigpic 实例对象
     * @return Result
     */
    @PutMapping("update")
    @ApiOperation("更新")
    public Result update(@ApiParam("更新json数据") @RequestBody BrandBigpic brandBigpic) {
        return new Result(ReturnStatus.SUCCESS.getReturnCode(),
                ReturnStatus.SUCCESS.getReturnMsg(), this.brandBigpicService.update(brandBigpic));
    }

    /**
     * 添加
     *
     * @param @param brandBigpic 实例对象
     * @return Result
     */
    @PostMapping("insert")
    @ApiOperation("添加")
    public Result insert(@ApiParam("添加json数据") @RequestBody BrandBigpic brandBigpic) {
        return new Result(ReturnStatus.SUCCESS.getReturnCode(),
                ReturnStatus.SUCCESS.getReturnMsg(), this.brandBigpicService.insert(brandBigpic));
    }
}